USE [web-vote]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_eleccion_empresa]') AND parent_object_id = OBJECT_ID(N'[dbo].[eleccion]'))
ALTER TABLE [dbo].[eleccion] DROP CONSTRAINT [FK_eleccion_empresa]
GO

USE [web-vote]
GO

/****** Object:  Table [dbo].[eleccion]    Script Date: 10/05/2013 10:44:36 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[eleccion]') AND type in (N'U'))
DROP TABLE [dbo].[eleccion]
GO

USE [web-vote]
GO

/****** Object:  Table [dbo].[eleccion]    Script Date: 10/05/2013 10:44:36 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[eleccion](
	[id_eleccion] [int] IDENTITY(1,1) NOT NULL,
	[titulo] [varchar](80) NOT NULL,
	[descripcion] [varchar](200) NOT NULL,
	[fecha_inicio] [datetime] NOT NULL,
	[fecha_fin] [datetime] NOT NULL,
	[Fecha_inicio_reg_candidato] [datetime] NOT NULL,
	[Fecha_fin_reg_candidato] [datetime] NOT NULL,
	[estado] [bit] NOT NULL,
	[id_empresa] [int] NOT NULL,
 CONSTRAINT [PK_eleccion] PRIMARY KEY CLUSTERED 
(
	[id_eleccion] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[eleccion]  WITH CHECK ADD  CONSTRAINT [FK_eleccion_empresa] FOREIGN KEY([id_empresa])
REFERENCES [dbo].[empresa] ([id_empresa])
GO

ALTER TABLE [dbo].[eleccion] CHECK CONSTRAINT [FK_eleccion_empresa]
GO


